import 'package:baselib/base/base_view_model.dart';
import 'package:baselib/net/baseentity.dart';
import 'package:get/get.dart';
import 'package:flustars/flustars.dart';
import 'package:moduleone/entity/user_entity.dart';
import 'package:moduleone/module/service/module_one_service.dart';
import 'package:moduleone/module/service/module_one_service.dart';

class ModuleOneViewModel extends BaseViewModel<ModuleOneService>{
  ModuleOneService moduleOneService;
  RxMap arguments={}.obs;
  RxString upValue=''.obs;

  @override
  ModuleOneService createService()=>(moduleOneService=ModuleOneService());

  RxInt count=0.obs;

  increase(){
      // count++;
    // count.value=ModuleOneService.getCount(count.value);
    // var countTwo = ModuleOneService.getCountTwo(1);
    // print('countTwo-->$countTwo');
    _getData();
      // update();
  }

    @override
  void onReady() {
    // TODO: implement onReady
    //   arguments.value = Get.arguments;
    //   upValue.value=arguments['value'];
    //   print('arguments-->${arguments.toString()}');
    _getData();
    super.onReady();
  }

  void _getData() async{
        print('getData-->');
        // increase();
        BaseEntity post =await moduleOneService.getData();
        // count.value=(post.data as UserOneEntity)?.age;
        LogUtil.e("返回的数据 data=${post?.toString()}");
        // DioUtils.instance.post('https://img.baidu.com/it/u=2605112544,759365927&fm=15&fmt=auto&gp=0.jpg');
  }

  toNextPage() async{
    // NavigatorUtils.pushByName(RouteConfig.getTwoMainTabPage,arguments: {'name':'小李','userEntity':UserEntity(name: '小丽')},resultFunc: (value){
    //   print('_toNextPage-->value=${value}');
    // });
    var post =await moduleOneService.getDataTwo();

    LogUtil.e("返回的数据 data=${post?.toString()}");
   }



}